<?php
    include 'base.php';

    $imgUrl = $_POST['imgUrl'];
    $href = $_POST['href'];
    $title = $_POST['title'];

    $sql = "INSERT INTO `banner`(`imgUrl`, `href`, `title`) VALUES ('$imgUrl','$href','$title')";

    $res = $conn -> query($sql);

    if ($res) {
        echo json_encode(array(
            'code' => 0,
            'msg' => '添加成功',
            'data' => null
        ));
    } else {
        echo json_encode(array(
            'code' => 1,
            'msg' => '添加失败',
            'data' => null
        ));
    }
?>